package 多线程;

public class 创建线程一继承Thread {
    /*
    * 1.创建一个MyThread类继承Thread类，并重写run()方法
    * 2.创建MyThread类的对象
    * 3.实现start()方法
    * */
    static class MyThread extends Thread{
        @Override
        public void run() {
            for (int i = 1; i < 6; i++) {
                System.out.println("子线程" + i);
            }
        }
    }
    public static void main(String[] args) {
        Thread t = new MyThread();
        t.start();
        for (int i = 1; i < 6; i++) {
            System.out.println("主线程" + i);
        }
    }

}
